	<?php $this->load->view('admin/partials/coupon_menu'); ?>
	<?php 
		$ci= &get_instance();
		$couponModeArray = couponModeDataConfig();
	?>
		
	<div class="clrboth"></div>

	<h3>Pending Coupon</h3>
	<?php $buttons = array('buttons'=>array('Add#add_coupon();') );?>
	<?php $this->load->view('admin/partials/buttons', $buttons ); ?>
	
	<div class="clrboth"></div>

	<table border="0" class="table-list">
		<thead>
			<tr> 	 	 	 	
				<th>Code</th>
				<th>Coin</th>
				<th>Start time</th>
				<th>End time</th>
				<th>Create time</th>
				<th>Mode</th>
				<th>Username</th>
				<th>Credits</th>
				<th>Manage</th>
			</tr>
		</thead>
		
		<tbody>
			<?php foreach( $items['records'] as $item ): ?>
			<?php 
				$COUPON = $ci->coupon_entity->init('id',$item->id);
			?>
			<tr>
				<td><?php echo $COUPON->getCode(); ?></td>
				<td><?php echo $COUPON->getCoin(); ?></td>
				<td><?php echo sysDateTimeFormat($COUPON->getStartDate(), DATE_FM); ?></td>
				<td><?php echo sysDateTimeFormat($COUPON->getEndDate() , DATE_FM); ?></td>
				<td><?php echo sysDateTimeFormat($COUPON->getCreateDate() , DATE_FM); ?></td>
				<td><?php if($COUPON->getMode()) echo $couponModeArray[$COUPON->getMode()]; ?></td>
				<td><?php echo $COUPON->getUsername(); ?></td>
				<td><?php echo $COUPON->getCredits(); ?></td>
				<td>
					<a href="javascript:void(0);" onclick="edit_coupon(<?php echo $item->id;?>);" >Edit</a>
					&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="delete_coupon(<?php echo $item->id;?>);" >Delete</a>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<div class="inner"><?php echo $items['pagination']['links'];?></div>

